<template>
<div>
  <h2>微信用户管理</h2>
  <el-table
      :data="memberList"
      style="width: 100%">
    <el-table-column
        prop="nickName"
        label="姓名"
        width="120">
    </el-table-column>
    <el-table-column
        prop="openId"
        label="微信ID"
        width="120">
    </el-table-column>
    <el-table-column
        prop="state"
        label="状态"
        width="50">
    </el-table-column>
    <el-table-column
        prop="createTime"
        label="创建时间"
        width="200">
    </el-table-column>
    <el-table-column
        prop="updateTime"
        label="更新时间"
        width="200">
    </el-table-column>
    <el-table-column
        fixed="right"
        label="操作"
        width="120">
      <template slot-scope="scope">
        <el-button
            @click.native.prevent="deleteRow(scope.$index, tableData)"
            type="text"
            size="small">
          移除
        </el-button>
      </template>
    </el-table-column>
  </el-table>
  <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="pageNum"
      :page-sizes="[1,5,10, 20, 30, 40]"
      :page-size="pageSize"
      layout="total, sizes, prev, pager, next, jumper"
      :total="total">
  </el-pagination>
</div>
</template>

<script>
import {getWechatMemberList} from '@/api/wechat'


export default {
  name: "WechatMemberManager",
  data(){
    return{
      memberList:[],
      total: 0,
      pageNum:1,
      pageSize:1



    }
  },

  mounted(){
    this.getList();
  },
  methods: {
    getList() {
      getWechatMemberList({pageNum:this.pageNum, pageSize: this.pageSize}).then(response => {
        this.memberList = response.data.records;
        this.total = response.data.total;

      });
    },
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
      this.pageSize = val;
      this.getList();

    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
      this.pageNum = val;
      this.getList();
    }
  }
}
</script>

<style scoped>

</style>
